//
//  EGORefreshTableHeaderView.h
//  eNew
//
//  Created by 李佳骏 on 15-4-30.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import <UIKit/UIKit.h>

#import <QuartzCore/QuartzCore.h> // 动画和效果

#import "CircleView.h"

typedef enum{
    EGOOPullRefreshPulling = 0, //下拉状态
    
    EGOOPullRefreshNormal,      // 正常状态
    
    EGOOPullRefreshLoading,     // 数据加载状态
    
} EGOPullRefreshState;


#pragma mark 声明协议
@protocol EGORefreshTableHeaderDelegate;

@interface EGORefreshTableHeaderView : UIView {
    
    id _delegate;
    EGOPullRefreshState _state; //
    
    UILabel *_lastUpdatedLabel;  // 刷新时间
    
    UILabel *_statusLabel;       // 状态
    
    CALayer *_arrowImage;         // 装载显示动画
    
    CircleView *_circleView;      // 图片视图
    
    UIActivityIndicatorView *_activityView;   // 显示等待动画
    
    
}


#pragma mark - 声明协议对象

@property(nonatomic,assign) id <EGORefreshTableHeaderDelegate> delegate;

- (void)refreshLastUpdatedDate;

- (void)egoRefreshScrollViewWillBeginScroll:(UIScrollView *)scrollView;

- (void)egoRefreshScrollViewDidScroll:(UIScrollView *)scrollView;

- (void)egoRefreshScrollViewDidEndDragging:(UIScrollView *)scrollView;

- (void)egoRefreshScrollViewDataSourceDidFinishedLoading:(UIScrollView *)scrollView;

@end


#pragma mark - 定义协议方法

@protocol EGORefreshTableHeaderDelegate

// 下拉调用
- (void)egoRefreshTableHeaderDidTriggerRefresh:(EGORefreshTableHeaderView*)view;

//判断刷新状态，正在刷新或者没有刷新
- (BOOL)egoRefreshTableHeaderDataSourceIsLoading:(EGORefreshTableHeaderView*)view;

@optional  // 可选

// 返回刷新时间，回调方法
- (NSDate*)egoRefreshTableHeaderDataSourceLastUpdated:(EGORefreshTableHeaderView*)view;
@end
